<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
		<meta http-equiv="Cache" content="no-cache">
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Expires" content="0" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title> {$title} </title>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
		<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
		<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
		<![endif]-->
		<script>
			document.write("<link rel='stylesheet' href='/static/component/laytp/css/laytp.css?v="+localStorage.getItem("version")+"'>");
			document.write("<link rel='stylesheet' href='/static/admin/css/load.css?v="+localStorage.getItem("version")+"'>");
			document.write("<link rel='stylesheet' href='/static/admin/css/admin.css?v="+localStorage.getItem("version")+"'>");
		</script>
	</head>
	<!-- 结 构 代 码 -->
	<body class="layui-layout-body laytp-admin" style="display: none;">
		<!-- 布 局 框 架 -->
		<div class="layui-layout layui-layout-admin">
			<div class="layui-header">
				<!-- 菜 单 顶 部 -->
<!--				<div class="layui-logo">-->
<!--					&lt;!&ndash; 图 标 &ndash;&gt;-->
<!--					<img class="logo">-->
<!--					&lt;!&ndash; 标 题 &ndash;&gt;-->
<!--					<span class="title"></span>-->
<!--				</div>-->
				<!-- 顶 部 左 侧 功 能 -->
				<ul class="layui-nav layui-layout-left">
					<li class="collapse layui-nav-item"><a href="javascript:void(0);" class="layui-icon layui-icon-shrink-right"></a></li>
					<li class="refresh layui-nav-item"><a href="javascript:void(0);" class="layui-icon layui-icon-refresh-1" loading=600></a></li>
				</ul>
				<!-- 多 系 统 菜 单 -->
				<div id="control" class="layui-layout-control"></div>
				<!-- 顶 部 右 侧 菜 单 -->
				<ul class="layui-nav layui-layout-right">
					<li class="layui-nav-item layui-hide-xs"><a href="javascript:void(0);" class="menuSearch layui-icon layui-icon-search"></a></li>
					<li class="layui-nav-item layui-hide-xs"><a href="javascript:void(0);" class="fullScreen layui-icon layui-icon-screen-full"></a></li>
<!--					<li class="layui-nav-item layui-hide-xs"><a href="http://www.laytp.com" class="layui-icon layui-icon-website"></a></li>-->
					<li class="layui-nav-item layui-hide-xs message"></li>
					<li class="layui-nav-item user">
						<!-- 头 像 -->
						<a href="javascript:;">
							<img class="layui-nav-img">
						</a>
						<!-- 功 能 菜 单 -->
						<dl class="layui-nav-child">
<!--							<dd><a user-menu-url="/admin/user/single.html" user-menu-id="999999999" user-menu-title="基本资料">基本资料</a></dd>-->
							<dd><a href="javascript:void(0);" class="logout">退出登录</a></dd>
						</dl>
					</li>
					<!-- 主 题 配 置 -->
					<li class="layui-nav-item setting"><a href="javascript:void(0);" class="layui-icon layui-icon-more-vertical"></a></li>
				</ul>
			</div>
			<!-- 侧 边 区 域 -->
			<div class="layui-side layui-bg-black">
				<!-- 菜 单 顶 部 -->
				<div class="layui-logo">
					<!-- 图 标 -->
					<img class="logo" />
					<!-- 标 题 -->
					<span class="title"></span>
				</div>
				<!-- 菜 单 内 容 -->
				<div class="layui-side-scroll">
					<div id="sideMenu"></div>
				</div>
			</div>
			<!-- 视 图 页 面 -->
			<div class="layui-body">
				<!-- 内 容 页 面 -->
				<div id="content"></div>
			</div>
			<!-- 遮 盖 层 -->
			<div class="laytp-cover"></div>
			<!-- 加 载 动 画-->
			<div class="loader-main">
				<div class="loader"></div>
			</div>
		</div>
		<!-- 移 动 端 便 捷 操 作 -->
		<div class="laytp-collasped-pe collaspe" style="display:none;">
			<a href="javascript:void(0);" class="layui-icon layui-icon-shrink-right"></a>
		</div>
		<!-- 依 赖 脚 本 -->
		<script>
			document.write("<script src='/static/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
			document.write("<script src='/static/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
		</script>
		<!-- 框 架 初 始 化 -->
		<script>
			window.ltVersion = '3.0.0';
			layui.use(['laytp','admin','popup','context'], function() {
				var context = layui.context;
				// ajax请求，更新缓存
				facade.ajax({route: '/admin/Admin/loginInfo',successAlert:false}).done(function(res){
					if (res['code'] === 0) {
						ltVersion = res.data.ltVersion;
						context.put("user", res.data.user);
						context.put("authList", res.data.authList);
						context.put("pluginConf", res.data.pluginConf);

						// 初始化顶部用户信息
						var user = res.data.user;
						if(user){
							layui.admin.setAvatar(user.avatar,user.nickname);
                            layui.admin.setConfigType("yml");
                            var laytpConfigYmlPath= '';
							laytpConfigYmlPath = "/static/component/laytp/config/laytp.config.yml?v=" + localStorage.getItem("version")
                            layui.admin.setConfigPath(laytpConfigYmlPath);
                            layui.admin.render();
                            $('body').show();
						}else{
                            facade.redirect("/admin/Admin/login");
							return false;
						}
						// 登出逻辑
						layui.admin.logout(function(){
							layui.popup.success("退出成功",function(){
								facade.ajax({
									route: "/admin/Admin/logout"
								}).done(function(){
                                    facade.redirect("/admin/Admin/login");
								});
							});
							// 退出逻辑 返回 true / false
							return true;
						});
						// 重写消息回调 [消息列表点击事件]
						// admin.message(function(id, title, context, form) {});
					}else{
						$('.layui-layout-admin').html('');
						$('body').show();
					}
				}).fail(function(){
					$('.layui-layout-admin').html('');
					$('body').show();
				});

                // 重新渲染菜单
                window.renderMenu = function(){
                    layui.admin.setConfigType("yml");
                    var laytpConfigYmlPath= '';
					laytpConfigYmlPath = "/static/component/laytp/config/laytp.config.yml?v=" + localStorage.getItem("version")
                    layui.admin.setConfigPath(laytpConfigYmlPath);
                    var config = layui.admin.readConfig();
                    layui.admin.menuRender(config);
                };
			});
		</script>
		<script type="text/html" id="default-toolbar">
			<button class="laytp-btn laytp-btn-primary laytp-btn-md" lay-event="add">
				<i class="layui-icon layui-icon-add-1"></i>
				新增
			</button>
			<button class="laytp-btn laytp-btn-danger laytp-btn-md" lay-event="batchRemove">
				<i class="layui-icon layui-icon-delete"></i>
				删除
			</button>
			<button class="laytp-btn laytp-btn-warming laytp-btn-md" lay-event="batchRemove">
				<i class="layui-icon layui-icon-search"></i>
				搜索
			</button>
		</script>
	</body>
</html>
